{% extends "main/base.html" %}
{% load i18n static main_tag %}
{% block title %}{% trans '用户操作记录' %}{% endblock %}
{% block content %}
<section class="panel">
    <div class="panel-body">
        <div class="col-md-12">
            <form class="form-inline" role="form" method="get">
                {% if created_bys %}
                <div class="form-group">
                    <select name="d" class="selectpicker show-tick form-control" data-live-search="true">
                        <option value="">{% trans '用户' %}</option>
                        {% for ss in created_bys %}
                            {% if ss.pk|floatformat:'0' == request.GET.d|floatformat:'0' %}
                            <option value="{{ ss.pk }}" selected>{{ ss }}</option>
                            {% else %}
                            <option value="{{ ss.pk }}" >{{ ss }}</option>
                            {% endif %}
                        {% endfor %}
                    </select>
                </div>
                {% endif %}
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon">{% trans '起始' %}:</span>
                        <input type="date" name="s" class="form-control" value="{% if request.GET.s %}{{ request.GET.s }}{% endif %}">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <span class="input-group-addon">{% trans '截止' %}:</span>
                        <input type="date" name="e" class="form-control" value="{% if request.GET.e %}{{ request.GET.e }}{% endif %}">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <input class="form-control" type="text" name="q" placeholder="" value="{% if request.GET.q %}{{ request.GET.q }}{% endif %}">
                        <span class="input-group-btn"><button class="btn btn-primary" type="submit">搜索</button></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<section class="panel">
    {% get_current_language as LANGUAGE_CODE %}
    <div class="table-responsive panel-body">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>{% trans '操作时间' %}</th>
                    <th>{% trans '用户' %}</th>
                    <th>{% trans '项目' %}</th>
                    <th>{% trans '操作' %}</th>
                    <th>{% trans '描述' %}</th>
                </tr>
            </thead>
            <tbody>{% for d in page_obj %}
                <tr class="{% cycle '' 'active' %}">
                    <th>{{ d.action_time }}</th>
                    <td>{{ d.user }}</td>
                    <td>{{ d.content_type }}</td>
                    <td>{{ d.action_flag }}</td>
                    <td>{{ d }}</td>
                </tr>{% endfor %}
            </tbody>
        </table>
        <div align="right">
            {% include 'main/tablenav.html' %}
        </div>
    </div>
</section>
{% endblock %}